/**
 * 存储全局变量
 */
export default {
    namespaced: true,
    state: () => ({
        userId: 0,
        appId: '',
        appInfo: {
            vip: 0
        },
    }),
    mutations: {
        setUserId (state, userId) {
            state.userId = userId;
        },
        setAppId (state, appId='') {
            state.appId = appId;
            sessionStorage.setItem('appId', appId)
        },
        setAppInfo (state, appInfo={}) {
            state.appInfo = appInfo;
            sessionStorage.setItem('appInfo', JSON.stringify(appInfo))
        }
    },
    getters: {
        userId: state => state.userId,
        appId: state => state.appId,
        appInfo: state => state.appInfo

    }
}
